package visual;

import java.awt.Dimension;
import javax.swing.JPanel;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.BorderLayout;
import java.awt.HeadlessException;

import javax.swing.JLabel;
import java.awt.Font;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.BorderFactory;
import javax.swing.border.BevelBorder;
import javax.swing.JButton;
import java.awt.Color;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.JComboBox;
import javax.swing.JCheckBox;
import javax.swing.JRadioButton;

import negocio.GerenciadorFuncionario;

import modelo.Funcionario;

public class FrmCadastroFuncionario extends FormularioBase {

	private Funcionario funcionario;  //  @jve:decl-index=0:
	
	private JPanel jPanel = null;
	private BarraDeControle barraDeControle = null;
	private JLabel jLabel = null;
	private JPanel jPanel1 = null;
	private JPanel jPanel2 = null;
	private JLabel jLabel2 = null;
	private JTextField registroTextField = null;
	private JPanel jPanel3 = null;
	private JLabel jLabel1 = null;
	private JTextField nomeTextField = null;
	private JLabel jLabel3 = null;
	private JLabel jLabel4 = null;
	private JTextField matriculaTextField = null;
	private JButton feriasButton = null;
	private JButton licencaPremioButton = null;
	private JButton dependentesButton = null;
	private JTabbedPane jTabbedPane = null;
	private JPanel dadosPessoaisPanel = null;
	private JPanel documentacaoPanel = null;
	private JPanel admissaoContratoPanel6 = null;
	private JPanel lotacaoSituacaoPanel = null;
	private JPanel calculosPanel = null;
	private JLabel jLabel5 = null;
	private JTextField admissaoTextField = null;
	private JLabel jLabel6 = null;
	private JComboBox jComboBox = null;
	private JLabel jLabel7 = null;
	private JTextField salarioTextField = null;
	private JCheckBox funcionarioRecebeQuinquenioCheckBox = null;
	private JCheckBox contribuicaoSindicalAutomaticaCheckBox = null;
	private JLabel jLabel8 = null;
	private JTextField jTextField5 = null;
	private JLabel jLabel9 = null;
	private JTextField jTextField6 = null;
	private JLabel jLabel10 = null;
	private JLabel jLabel11 = null;
	private JComboBox jComboBox1 = null;
	private JComboBox jComboBox2 = null;
	private JLabel jLabel12 = null;
	private JTextField jTextField7 = null;
	private JLabel jLabel13 = null;
	private JComboBox jComboBox3 = null;
	private JLabel jLabel14 = null;
	private JComboBox jComboBox4 = null;
	private JComboBox jComboBox5 = null;
	private JLabel jLabel15 = null;
	private JLabel jLabel16 = null;
	private JTextField jTextField8 = null;
	private JLabel jLabel17 = null;
	private JComboBox jComboBox6 = null;
	private JLabel filiacaoLabel = null;
	private JLabel jLabel18 = null;
	private JTextField jTextField9 = null;
	private JLabel jLabel19 = null;
	private JTextField jTextField10 = null;
	private JLabel enderecoLabel = null;
	private JLabel jLabel20 = null;
	private JLabel jLabel21 = null;
	private JLabel jLabel22 = null;
	private JLabel jLabel23 = null;
	private JLabel jLabel24 = null;
	private JLabel jLabel25 = null;
	private JTextField jTextField11 = null;
	private JTextField jTextField12 = null;
	private JTextField jTextField13 = null;
	private JTextField jTextField14 = null;
	private JComboBox jComboBox7 = null;
	private JTextField jTextField15 = null;
	/**
	 * This method initializes 
	 * 
	 */
	public FrmCadastroFuncionario() {
		super(null);
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 */
	private void initialize() {
        this.setSize(new Dimension(727, 509));
        this.setContentPane(getJPanel());
        this.setTitle("Cadastro de funcionário");
        this.addWindowListener(new java.awt.event.WindowAdapter() {
        	public void windowOpened(java.awt.event.WindowEvent e) {
        		System.out.println("windowOpened()"); // TODO Auto-generated Event stub windowOpened()
        		if(getId() == 0){
        			configuraNovo();
        		}else{
        			configuraEdicao();
        		}
        	}
        });
        getBarraDeControle().setFormulario(this);
	}

	/**
	 * This method initializes jPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel() {
		if (jPanel == null) {
			jLabel = new JLabel();
			jLabel.setText("Cadastro de funcionário");
			jLabel.setFont(new Font("Dialog", Font.BOLD, 24));
			jPanel = new JPanel();
			jPanel.setLayout(new BorderLayout());
			jPanel.add(getBarraDeControle(), BorderLayout.SOUTH);
			jPanel.add(jLabel, BorderLayout.NORTH);
			jPanel.add(getJPanel1(), BorderLayout.CENTER);
		}
		return jPanel;
	}

	/**
	 * This method initializes barraDeControle	
	 * 	
	 * @return visual.BarraDeControle	
	 */
	private BarraDeControle getBarraDeControle() {
		if (barraDeControle == null) {
			barraDeControle = new BarraDeControle();
		}
		return barraDeControle;
	}

	/**
	 * This method initializes jPanel1	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel1() {
		if (jPanel1 == null) {
			jPanel1 = new JPanel();
			jPanel1.setLayout(null);
			jPanel1.add(getJPanel2(), null);
			jPanel1.add(getJTabbedPane(), null);
		}
		return jPanel1;
	}

	/**
	 * This method initializes jPanel2	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel2() {
		if (jPanel2 == null) {
			jLabel4 = new JLabel();
			jLabel4.setBounds(new Rectangle(421, 19, 71, 14));
			jLabel4.setText("Matricula:");
			jLabel3 = new JLabel();
			jLabel3.setBounds(new Rectangle(174, 49, 45, 14));
			jLabel3.setText("Nome:");
			jLabel2 = new JLabel();
			jLabel2.setBounds(new Rectangle(154, 19, 65, 14));
			jLabel2.setText("Registro:");
			jPanel2 = new JPanel();
			jPanel2.setLayout(null);
			jPanel2.setBounds(new Rectangle(15, 15, 691, 106));
			jPanel2.setBorder(BorderFactory.createLineBorder(Color.gray, 2));
			jPanel2.add(jLabel2, null);
			jPanel2.add(getRegistroTextField(), null);
			jPanel2.add(getJPanel3(), null);
			jPanel2.add(getNomeTextField(), null);
			jPanel2.add(jLabel3, null);
			jPanel2.add(jLabel4, null);
			jPanel2.add(getMatriculaTextField(), null);
			jPanel2.add(getFeriasButton(), null);
			jPanel2.add(getLicencaPremioButton(), null);
			jPanel2.add(getDependentesButton(), null);
		}
		return jPanel2;
	}

	/**
	 * This method initializes registroTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getRegistroTextField() {
		if (registroTextField == null) {
			registroTextField = new JTextField();
			registroTextField.setBounds(new Rectangle(225, 15, 181, 18));
		}
		return registroTextField;
	}

	/**
	 * This method initializes jPanel3	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel3() {
		if (jPanel3 == null) {
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			jLabel1 = new JLabel();
			jLabel1.setText("Foto 3x4");
			jPanel3 = new JPanel();
			jPanel3.setLayout(new GridBagLayout());
			jPanel3.setBounds(new Rectangle(15, 15, 111, 74));
			jPanel3.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
			jPanel3.add(jLabel1, gridBagConstraints);
		}
		return jPanel3;
	}

	/**
	 * This method initializes nomeTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getNomeTextField() {
		if (nomeTextField == null) {
			nomeTextField = new JTextField();
			nomeTextField.setBounds(new Rectangle(225, 45, 451, 18));
		}
		return nomeTextField;
	}

	/**
	 * This method initializes matriculaTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getMatriculaTextField() {
		if (matriculaTextField == null) {
			matriculaTextField = new JTextField();
			matriculaTextField.setBounds(new Rectangle(495, 15, 181, 18));
		}
		return matriculaTextField;
	}

	/**
	 * This method initializes feriasButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getFeriasButton() {
		if (feriasButton == null) {
			feriasButton = new JButton();
			feriasButton.setBounds(new Rectangle(225, 75, 140, 24));
			feriasButton.setText("Férias");
		}
		return feriasButton;
	}

	/**
	 * This method initializes licencaPremioButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getLicencaPremioButton() {
		if (licencaPremioButton == null) {
			licencaPremioButton = new JButton();
			licencaPremioButton.setBounds(new Rectangle(380, 75, 140, 24));
			licencaPremioButton.setText("Licença prêmio");
		}
		return licencaPremioButton;
	}

	/**
	 * This method initializes dependentesButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getDependentesButton() {
		if (dependentesButton == null) {
			dependentesButton = new JButton();
			dependentesButton.setBounds(new Rectangle(536, 75, 140, 24));
			dependentesButton.setText("Dependentes");
			dependentesButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
					FrmCadastroDependente frm = new FrmCadastroDependente();
					System.out.println(funcionario.getNome());
					frm.setFuncionario(funcionario);
					frm.setVisible(true);
				}
			});
		}
		return dependentesButton;
	}

	/**
	 * This method initializes jTabbedPane	
	 * 	
	 * @return javax.swing.JTabbedPane	
	 */
	private JTabbedPane getJTabbedPane() {
		if (jTabbedPane == null) {
			jTabbedPane = new JTabbedPane();
			jTabbedPane.setBounds(new Rectangle(15, 135, 691, 271));
			jTabbedPane.addTab("Dados pessoais", null, getDadosPessoaisPanel(), null);
			jTabbedPane.addTab("Documentação", null, getDocumentacaoPanel(), null);
			jTabbedPane.addTab("Admissão / Contrato", null, getAdmissaoContratoPanel6(), null);
			jTabbedPane.addTab("Lotação / Situação", null, getLotacaoSituacaoPanel(), null);
			jTabbedPane.addTab("Calculos", null, getCalculosPanel(), null);
		}
		return jTabbedPane;
	}

	/**
	 * This method initializes dadosPessoaisPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getDadosPessoaisPanel() {
		if (dadosPessoaisPanel == null) {
			jLabel25 = new JLabel();
			jLabel25.setBounds(new Rectangle(570, 211, 23, 14));
			jLabel25.setText("UF:");
			jLabel24 = new JLabel();
			jLabel24.setBounds(new Rectangle(295, 211, 48, 14));
			jLabel24.setText("Bairro:");
			jLabel23 = new JLabel();
			jLabel23.setBounds(new Rectangle(29, 211, 102, 14));
			jLabel23.setText("Complemento:");
			jLabel22 = new JLabel();
			jLabel22.setBounds(new Rectangle(465, 183, 67, 14));
			jLabel22.setText("Telefone:");
			jLabel21 = new JLabel();
			jLabel21.setBounds(new Rectangle(315, 183, 60, 14));
			jLabel21.setText("Número:");
			jLabel20 = new JLabel();
			jLabel20.setBounds(new Rectangle(28, 183, 88, 14));
			jLabel20.setText("Logradouro:");
			enderecoLabel = new JLabel();
			enderecoLabel.setBounds(new Rectangle(29, 155, 66, 14));
			enderecoLabel.setText("Endereço");
			enderecoLabel.setForeground(Color.red);
			jLabel19 = new JLabel();
			jLabel19.setBounds(new Rectangle(360, 127, 35, 14));
			jLabel19.setText("Mãe:");
			jLabel18 = new JLabel();
			jLabel18.setBounds(new Rectangle(28, 127, 27, 14));
			jLabel18.setText("Pai:");
			filiacaoLabel = new JLabel();
			filiacaoLabel.setBounds(new Rectangle(30, 99, 54, 14));
			filiacaoLabel.setText("Filiação");
			filiacaoLabel.setForeground(Color.red);
			jLabel17 = new JLabel();
			jLabel17.setBounds(new Rectangle(496, 71, 72, 14));
			jLabel17.setText("instrução:");
			jLabel16 = new JLabel();
			jLabel16.setBounds(new Rectangle(271, 71, 97, 14));
			jLabel16.setText("Ano chegada:");
			jLabel15 = new JLabel();
			jLabel15.setBounds(new Rectangle(30, 71, 106, 14));
			jLabel15.setText("Nacionalidade:");
			jLabel14 = new JLabel();
			jLabel14.setBounds(new Rectangle(480, 43, 84, 14));
			jLabel14.setText("Estado civil:");
			jLabel13 = new JLabel();
			jLabel13.setBounds(new Rectangle(271, 43, 82, 14));
			jLabel13.setText("Deficiência:");
			jLabel12 = new JLabel();
			jLabel12.setBounds(new Rectangle(61, 43, 75, 14));
			jLabel12.setText("Cor / Raça:");
			jLabel11 = new JLabel();
			jLabel11.setBounds(new Rectangle(555, 15, 43, 14));
			jLabel11.setText("Sexo:");
			jLabel10 = new JLabel();
			jLabel10.setBounds(new Rectangle(451, 15, 23, 14));
			jLabel10.setText("UF:");
			jLabel9 = new JLabel();
			jLabel9.setBounds(new Rectangle(255, 15, 72, 14));
			jLabel9.setText("Município:");
			jLabel8 = new JLabel();
			jLabel8.setBounds(new Rectangle(18, 15, 118, 14));
			jLabel8.setText("Data Nacimento:");
			dadosPessoaisPanel = new JPanel();
			dadosPessoaisPanel.setLayout(null);
			dadosPessoaisPanel.add(jLabel8, null);
			dadosPessoaisPanel.add(getJTextField5(), null);
			dadosPessoaisPanel.add(jLabel9, null);
			dadosPessoaisPanel.add(getJTextField6(), null);
			dadosPessoaisPanel.add(jLabel10, null);
			dadosPessoaisPanel.add(jLabel11, null);
			dadosPessoaisPanel.add(getJComboBox1(), null);
			dadosPessoaisPanel.add(getJComboBox2(), null);
			dadosPessoaisPanel.add(jLabel12, null);
			dadosPessoaisPanel.add(getJTextField7(), null);
			dadosPessoaisPanel.add(jLabel13, null);
			dadosPessoaisPanel.add(getJComboBox3(), null);
			dadosPessoaisPanel.add(jLabel14, null);
			dadosPessoaisPanel.add(getJComboBox4(), null);
			dadosPessoaisPanel.add(getJComboBox5(), null);
			dadosPessoaisPanel.add(jLabel15, null);
			dadosPessoaisPanel.add(jLabel16, null);
			dadosPessoaisPanel.add(getJTextField8(), null);
			dadosPessoaisPanel.add(jLabel17, null);
			dadosPessoaisPanel.add(getJComboBox6(), null);
			dadosPessoaisPanel.add(filiacaoLabel, null);
			dadosPessoaisPanel.add(jLabel18, null);
			dadosPessoaisPanel.add(getJTextField9(), null);
			dadosPessoaisPanel.add(jLabel19, null);
			dadosPessoaisPanel.add(getJTextField10(), null);
			dadosPessoaisPanel.add(enderecoLabel, null);
			dadosPessoaisPanel.add(jLabel20, null);
			dadosPessoaisPanel.add(jLabel21, null);
			dadosPessoaisPanel.add(jLabel22, null);
			dadosPessoaisPanel.add(jLabel23, null);
			dadosPessoaisPanel.add(jLabel24, null);
			dadosPessoaisPanel.add(jLabel25, null);
			dadosPessoaisPanel.add(getJTextField11(), null);
			dadosPessoaisPanel.add(getJTextField12(), null);
			dadosPessoaisPanel.add(getJTextField13(), null);
			dadosPessoaisPanel.add(getJTextField14(), null);
			dadosPessoaisPanel.add(getJComboBox7(), null);
			dadosPessoaisPanel.add(getJTextField15(), null);
		}
		return dadosPessoaisPanel;
	}

	/**
	 * This method initializes documentacaoPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getDocumentacaoPanel() {
		if (documentacaoPanel == null) {
			documentacaoPanel = new JPanel();
			documentacaoPanel.setLayout(new GridBagLayout());
		}
		return documentacaoPanel;
	}

	/**
	 * This method initializes admissaoContratoPanel6	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getAdmissaoContratoPanel6() {
		if (admissaoContratoPanel6 == null) {
			jLabel7 = new JLabel();
			jLabel7.setBounds(new Rectangle(82, 74, 55, 14));
			jLabel7.setText("Salário:");
			jLabel6 = new JLabel();
			jLabel6.setBounds(new Rectangle(17, 45, 120, 14));
			jLabel6.setText("Tipo pagamento:");
			jLabel5 = new JLabel();
			jLabel5.setBounds(new Rectangle(64, 16, 73, 14));
			jLabel5.setText("Admissão:");
			admissaoContratoPanel6 = new JPanel();
			admissaoContratoPanel6.setLayout(null);
			admissaoContratoPanel6.add(jLabel5, null);
			admissaoContratoPanel6.add(getAdmissaoTextField(), null);
			admissaoContratoPanel6.add(jLabel6, null);
			admissaoContratoPanel6.add(getJComboBox(), null);
			admissaoContratoPanel6.add(jLabel7, null);
			admissaoContratoPanel6.add(getSalarioTextField(), null);
		}
		return admissaoContratoPanel6;
	}

	/**
	 * This method initializes lotacaoSituacaoPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getLotacaoSituacaoPanel() {
		if (lotacaoSituacaoPanel == null) {
			lotacaoSituacaoPanel = new JPanel();
			lotacaoSituacaoPanel.setLayout(new GridBagLayout());
		}
		return lotacaoSituacaoPanel;
	}

	/**
	 * This method initializes calculosPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getCalculosPanel() {
		if (calculosPanel == null) {
			calculosPanel = new JPanel();
			calculosPanel.setLayout(null);
			calculosPanel.add(getFuncionarioRecebeQuinquenioCheckBox(), null);
			calculosPanel.add(getContribuicaoSindicalAutomaticaCheckBox(), null);
		}
		return calculosPanel;
	}

	/**
	 * This method initializes admissaoTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getAdmissaoTextField() {
		if (admissaoTextField == null) {
			admissaoTextField = new JTextField();
			admissaoTextField.setBounds(new Rectangle(150, 15, 121, 18));
		}
		return admissaoTextField;
	}

	/**
	 * This method initializes jComboBox	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	private JComboBox getJComboBox() {
		if (jComboBox == null) {
			jComboBox = new JComboBox();
			jComboBox.setBounds(new Rectangle(151, 42, 120, 23));
		}
		return jComboBox;
	}

	/**
	 * This method initializes salarioTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getSalarioTextField() {
		if (salarioTextField == null) {
			salarioTextField = new JTextField();
			salarioTextField.setBounds(new Rectangle(150, 74, 121, 18));
		}
		return salarioTextField;
	}

	/**
	 * This method initializes funcionarioRecebeQuinquenioCheckBox	
	 * 	
	 * @return javax.swing.JCheckBox	
	 */
	private JCheckBox getFuncionarioRecebeQuinquenioCheckBox() {
		if (funcionarioRecebeQuinquenioCheckBox == null) {
			funcionarioRecebeQuinquenioCheckBox = new JCheckBox();
			funcionarioRecebeQuinquenioCheckBox.setBounds(new Rectangle(15, 15, 252, 22));
			funcionarioRecebeQuinquenioCheckBox.setText("Funcionário recebe quinquênio?");
		}
		return funcionarioRecebeQuinquenioCheckBox;
	}

	/**
	 * This method initializes contribuicaoSindicalAutomaticaCheckBox	
	 * 	
	 * @return javax.swing.JCheckBox	
	 */
	private JCheckBox getContribuicaoSindicalAutomaticaCheckBox() {
		if (contribuicaoSindicalAutomaticaCheckBox == null) {
			contribuicaoSindicalAutomaticaCheckBox = new JCheckBox();
			contribuicaoSindicalAutomaticaCheckBox.setBounds(new Rectangle(16, 46, 264, 22));
			contribuicaoSindicalAutomaticaCheckBox.setText("Contribuição sindical automático?");
		}
		return contribuicaoSindicalAutomaticaCheckBox;
	}

	/**
	 * This method initializes jTextField5	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField5() {
		if (jTextField5 == null) {
			jTextField5 = new JTextField();
			jTextField5.setBounds(new Rectangle(150, 15, 98, 18));
		}
		return jTextField5;
	}

	/**
	 * This method initializes jTextField6	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField6() {
		if (jTextField6 == null) {
			jTextField6 = new JTextField();
			jTextField6.setBounds(new Rectangle(330, 15, 106, 18));
		}
		return jTextField6;
	}

	/**
	 * This method initializes jComboBox1	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	private JComboBox getJComboBox1() {
		if (jComboBox1 == null) {
			jComboBox1 = new JComboBox();
			jComboBox1.setBounds(new Rectangle(483, 11, 58, 23));
		}
		return jComboBox1;
	}

	/**
	 * This method initializes jComboBox2	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	private JComboBox getJComboBox2() {
		if (jComboBox2 == null) {
			jComboBox2 = new JComboBox();
			jComboBox2.setBounds(new Rectangle(600, 11, 76, 23));
		}
		return jComboBox2;
	}

	/**
	 * This method initializes jTextField7	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField7() {
		if (jTextField7 == null) {
			jTextField7 = new JTextField();
			jTextField7.setBounds(new Rectangle(150, 71, 106, 18));
		}
		return jTextField7;
	}

	/**
	 * This method initializes jComboBox3	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	private JComboBox getJComboBox3() {
		if (jComboBox3 == null) {
			jComboBox3 = new JComboBox();
			jComboBox3.setBounds(new Rectangle(152, 39, 104, 23));
		}
		return jComboBox3;
	}

	/**
	 * This method initializes jComboBox4	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	private JComboBox getJComboBox4() {
		if (jComboBox4 == null) {
			jComboBox4 = new JComboBox();
			jComboBox4.setBounds(new Rectangle(359, 39, 107, 23));
		}
		return jComboBox4;
	}

	/**
	 * This method initializes jComboBox5	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	private JComboBox getJComboBox5() {
		if (jComboBox5 == null) {
			jComboBox5 = new JComboBox();
			jComboBox5.setBounds(new Rectangle(570, 39, 106, 23));
		}
		return jComboBox5;
	}

	/**
	 * This method initializes jTextField8	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField8() {
		if (jTextField8 == null) {
			jTextField8 = new JTextField();
			jTextField8.setBounds(new Rectangle(375, 71, 106, 18));
		}
		return jTextField8;
	}

	/**
	 * This method initializes jComboBox6	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	private JComboBox getJComboBox6() {
		if (jComboBox6 == null) {
			jComboBox6 = new JComboBox();
			jComboBox6.setBounds(new Rectangle(572, 67, 104, 23));
		}
		return jComboBox6;
	}

	/**
	 * This method initializes jTextField9	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField9() {
		if (jTextField9 == null) {
			jTextField9 = new JTextField();
			jTextField9.setBounds(new Rectangle(60, 127, 286, 18));
		}
		return jTextField9;
	}

	/**
	 * This method initializes jTextField10	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField10() {
		if (jTextField10 == null) {
			jTextField10 = new JTextField();
			jTextField10.setBounds(new Rectangle(405, 127, 273, 18));
		}
		return jTextField10;
	}

	/**
	 * This method initializes jTextField11	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField11() {
		if (jTextField11 == null) {
			jTextField11 = new JTextField();
			jTextField11.setBounds(new Rectangle(125, 183, 176, 18));
		}
		return jTextField11;
	}

	/**
	 * This method initializes jTextField12	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField12() {
		if (jTextField12 == null) {
			jTextField12 = new JTextField();
			jTextField12.setBounds(new Rectangle(552, 183, 124, 18));
		}
		return jTextField12;
	}

	/**
	 * This method initializes jTextField13	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField13() {
		if (jTextField13 == null) {
			jTextField13 = new JTextField();
			jTextField13.setBounds(new Rectangle(136, 211, 150, 18));
		}
		return jTextField13;
	}

	/**
	 * This method initializes jTextField14	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField14() {
		if (jTextField14 == null) {
			jTextField14 = new JTextField();
			jTextField14.setBounds(new Rectangle(352, 211, 144, 18));
		}
		return jTextField14;
	}

	/**
	 * This method initializes jComboBox7	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	private JComboBox getJComboBox7() {
		if (jComboBox7 == null) {
			jComboBox7 = new JComboBox();
			jComboBox7.setBounds(new Rectangle(600, 207, 68, 23));
		}
		return jComboBox7;
	}

	/**
	 * This method initializes jTextField15	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField15() {
		if (jTextField15 == null) {
			jTextField15 = new JTextField();
			jTextField15.setBounds(new Rectangle(388, 183, 63, 18));
		}
		return jTextField15;
	}

	@Override
	public void carregaFormulario() {
		// TODO Auto-generated method stub
		GerenciadorFuncionario gerenciadorFuncionario = new GerenciadorFuncionario();
		funcionario = gerenciadorFuncionario.buscarFuncionario(getId());
		
		registroTextField.setText(String.valueOf(getId()));
		matriculaTextField.setText(funcionario.getMatricula());
		nomeTextField.setText(funcionario.getNome());
		
		SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");	
		admissaoTextField.setText(sdf.format(funcionario.getAdmissao()));
		
		salarioTextField.setText(String.valueOf(funcionario.getSalario()));
		funcionarioRecebeQuinquenioCheckBox.setSelected(funcionario.isFuncionarioRecebeQuinquenio());
		contribuicaoSindicalAutomaticaCheckBox.setSelected(funcionario.isContribuicaoSindicalAutimatica());
		
	}

	@Override
	public void salvaFormulario() {
		// TODO Auto-generated method stub
		try{
			funcionario = new Funcionario();
			
			funcionario.setId(getId());
			
			funcionario.setMatricula(matriculaTextField.getText());
			funcionario.setNome(nomeTextField.getText());
			funcionario.setSalario(Double.parseDouble(salarioTextField.getText()));

			SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
			funcionario.setAdmissao(sdf.parse(admissaoTextField.getText()));
			
			funcionario.setFuncionarioRecebeQuinquenio(funcionarioRecebeQuinquenioCheckBox.isSelected());
			funcionario.setContribuicaoSindicalAutimatica(contribuicaoSindicalAutomaticaCheckBox.isSelected());
			
			GerenciadorFuncionario gerenciadorFuncionario = new GerenciadorFuncionario();
			gerenciadorFuncionario.salvarFuncionario(funcionario);
			
			JOptionPane.showMessageDialog(this, "Funcionário salvo com sucesso");
			
			dispose();
		}catch(NumberFormatException e){
			JOptionPane.showMessageDialog(this, "formato de numero invalido");
		} catch (ParseException e) {
			JOptionPane.showMessageDialog(this, "formato de data invalido");
		}
	}

	@Override
	public void apagarFormulario() {
		// TODO Auto-generated method stub
		int opcao = JOptionPane.showConfirmDialog(this, "Deseja excluir esse funcionário","Atenção",
				JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
		if(opcao == JOptionPane.YES_OPTION){
			GerenciadorFuncionario gerenciadorFuncionario = new GerenciadorFuncionario();
			gerenciadorFuncionario.removerFuncionario(getId());
			this.dispose();
		}
		
	}

	@Override
	public void configuraEdicao() {
		// TODO Auto-generated method stub
		carregaFormulario();
		getBarraDeControle().ativaBotoes(false, false, false, true, true, true);
		getBarraDeControle().removerBotoes(true, true, false, false, false, false);

	}

	@Override
	public void configuraNovo() {
		// TODO Auto-generated method stub
		getBarraDeControle().ativaBotoes(false, false, false, true, false, false);
		getBarraDeControle().removerBotoes(true, true, false, false, false, false);
		getFeriasButton().setEnabled(false);
		getLicencaPremioButton().setEnabled(false);
		getDependentesButton().setEnabled(false);
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
